home *** CD-ROM | disk | FTP | other *** search
-
- ;xchange functionality of box to/from decision/simple function
-
- xchange:
- call get_current_box ;get current box pointer
- mov b chart_flag,4 ;set chart entry flag
- xor ax,ax ;clear yes route
- es cmp w[di+no],ax ;is box decision box?
- je >b1 ;convert to decision box if not
- es cmp w[di+no],1 ;is route for box, yes route
- je >b3 ;convert to function box if not
-
- ;check if there is a yes route
-
- es cmp w[di+yes],ax ;is there?
- je >b2 ;swap route to yes if not
- es mov ax,w[di+yes] ;load yes route
- es xchg ax,w[di+no] ;swap for no route
- es mov w[di+yes],ax ;store yes route
- stc ;goto start of chart loop
- ret ;exit
-
- ;make decision box simple function box
-
- b2:
- es xchg w[di+no],ax ;clear no route
- es mov w[di+yes],ax
- stc ;exit
- ret
-
- ;move yes route to no
-
- b3:
- es xchg w[di+yes],ax ;load yes route
- cmp ax,bp ;is route outstanding?
- je >c1 ;exit if it is
- or ax,ax ;is there a yes route?
- if ne es mov w[di+no],ax
- stc ;exit
- ret
-
- ;make current box decision box
-
- b1:
- es or w[di+yes],ax ;is there a route?
- if ne es mov w[di+no],1 ;make simple box decision box
- c1:
- stc ;goto start of chart loop
- ret ;exit
-
- ;relinquish branch route option
-
- relinquish:
- cmp w key_option,13*2 ;has route been chosen?
- je >a1 ;relinquish route if it has
- mov b new_chart,0 ;indicate chart changed
- mov bx,w first_branch_route ;copy first branch route
- mov w route,bx
- cmp w branch_route_count,1 ;is there more than one branches?
- je >a1 ;relinquish route if not
-
- ;prompt for which route to relinquish
-
- call write_message ;write prompt to buffer
- db 'Choose route to unlink',0
- mov w key_option,13*2 ;store key option
- mov w box_save,1 ;indicate flowchart not dormant
- mov w insert_mode,2
- mov w current_route,bx ;set current route
- call write_route_stem ;set route stem string
- mov b chart_flag,1 ;set chart entry flag
- stc ;exit to chart loop
- ret
-
- ;check if deleting route will split up chart
-
- a1:
- mov bx,w route ;load route to be severed
- call store_save_route ;save and clear route
- jb >c1 ;reset variables if route is terminator
- call will_box_be_missed ;will deleted route split up chart?
- jc >c1 ;exit if it will
-
- ;redirect current boxes leading neighbour box
-
- mov ax,dx ;load box to redirect
- xor bx,bx ;load offset to neighbour route
- call get_box_par ;get neighbour box
- or ax,ax ;is there one?
- je >c1 ;leave box if not
- mov ax,dx ;load box to redirect
- mov dx,si ;exchange destination box for link box
- call store_box_par ;redirect neighbour box
-
- ;clear branch from current route of current box
-
- c1:
- xor ax,ax ;load zero
- mov w branch_route_count,ax ;clear branch count
- mov w box_save,ax ;indicate flowchart is dormant
- mov w insert_mode,ax
- mov w key_option,ax ;clear key option indicator
- mov b message,al ;clear bottom line message buffer
- mov b chart_flag,4 ;set chart entry flag
- stc ;exit to chart loop
- ret
-
- ;save and clear current route
-
- store_save_route:
- call get_current_box ;get box to which it is linked
- xor dx,dx ;exchange zero for box of route
- es cmp w[di+no],dx ;is box decision box?
- je >a1 ;clear route if not
- cmp bx,no ;is current route 'no' route?
- if e inc dx ;indicate it is but without 'no' route
- a1:
- es xchg dx,w[di+bx] ;save it
- cmp dx,first_box ;is route to exit from sub_chart?
- ret ;exit
-
- ;check if any references from current box to start of current chart
-
- ;find link from ax:box to dx:box
-
- c1:
- mov sp,w temp1 ;restore stack
- ret ;exit
- find_box_to_box:
- mov w temp1,sp ;save stack pointer
- b1:
- call get_box ;get total real routes
- mov bx,no ;load offset to no route
- mov si,ax ;save this box id
- cmp ax,dx ;is search box in path?
- je c1 ;exit if it is
-
- ;save other route if two routes
-
- a1:
- es mov ax,w[di+bx] ;load route
- cmp ax,first_box ;is it a box route?
- jb >a2 ;move to next route if not
- cmp ax,dx ;does it point to neighbour box?
- je c1 ;delete box/route (exit)
-
- ;check if box of route has been checked
-
- push ax,bx ;save box id
- mov bx,box_temp ;load offset to box variable
- call get_box_par ;get box id
- pull bx ;restore offset to route
- or ah,ah ;has box been checked
- if e pull ax ;clear from stack if it has
- a2:
- dec bx,bx ;move to next route
- jne a1 ;check next route if not finished
-
- ;check if anymore boxes on stack
-
- es mov b[di+box_temp+1],bl ;indicate this box checked
- cmp sp,w temp1 ;anymore routes?
- stc ;indicate error
- je ret ;exit with error if not
- pull ax ;load next current box
- jmp b1 ;check for any references to current box
-
- ;check if route from current box to box:dx is only route
-
- will_box_be_missed:
- push dx,bp ;save box of route and current box
- call move_to_first_box ;move to first box in chart
- call reset_chart_flags_hi ;flag all boxes unchecked
- mov ax,bp ;load first box in chart
- pull bp,dx ;restore boxes
- call find_box_to_box ;check if alternative route to box
- jnc ret ;exit if found
-
- ;restore link to neighbour box
-
- e1:
- mov bx,w route ;load route offset
- call store_current_box_par ;restore route in dx to current box
- call clear_line ;clear bottom line
- call writexy ;write error message
- db 30,24
- db 'Chart will be split',0
- call key ;wait for keypress
- stc ;indicate error
- ret ;exit
-
- ;insert box option
-
- insert_box:
- call get_neighbour_route ;get connecting route
- mov dx,w next_box ;load new box
- jnc >a1 ;point following box to new box if no
- ;leading neighbour box
- call store_box_par ;point route of neighbour box to new box
- xor bx,bx ;load previous route offset
- a1:
- call store_current_box_par ;make new box neighbour box
-
- ;create new box and point it to leading neighbour box of current box
-
- call make_box ;create box
- stosw ;make new box neighbour of neighbour of
- ;current box
- mov bx,parent ;get parent route of neighbour box
- call get_current_box_par
- es mov w[di+parent-2],ax ;make new box parent of it
- and b box_made,1 ;indicate box made
- mov w box_save,bp ;inserted route to current box
-
- ;initialise variables for last insert operation
-
- call write_message ;write bottom line message
- db 'Choose route from inserted box to link',0
- mov w insert_mode,1 ;store insert mode flag
- mov w link_box,dx ;store new box
- mov b chart_flag,2 ;set chart entry flag
- stc ;exit to chart loop
- ret
-
- ;get connecting route of cuurent boxes leading neighbour box
-
- get_neighbour_route:
- xor bx,bx ;load previous box element offset
- call get_current_box_par ;get leading neighbour box
- or ax,ax ;is there one?
- je ret ;exit if not
- call get_routes ;get current box routes
- a1:
- add bx,2 ;move to next route
- cmp w[bx+routes],bp ;does route point to current box?
- jne a1 ;check next route if not
- stc ;indicate there is a neighbour box
- ret ;exit
-
- ;single option
-
- single:
- mov b chart_flag,4 ;store chart entry flag
- stc ;exit to chart loop
- ret
-
- ;yes route option
-
- yes_option:
- mov dx,yes ;load single/yes route indicator
- other_options:
- mov w current_route,dx ;set current route
- mov b route_string,'(' ;store bracket indicators
- mov b route_string+1,al ;save route character
- mov b route_string+2,')'
- mov b chart_flag,1 ;store chart entry flag
- stc ;exit to chart loop
- ret
-
- ;no route option
-
- no_option:
- mov dx,no ;load route element offset
- jmp other_options ;set current route
-
- ;no route option
-
- no_route:
- inc bx ;increment route marker
-
- ;yes route option
-
- yes_route:
- inc bx ;increment route marker
- shl bx,1 ;convert route marker to offset
-
- move_to_route:
- mov ax,bp ;load current box
- xor bp,bp ;indicate moving to route
- call get_route3 ;get box of route
- mov bp,ax
-
- ;set chart entry flag and exit
-
- mov b chart_flag,1 ;set chart entry flag
- cmp w box_save,0 ;is flowchart dormant?
- if e mov b chart_flag,4 ;set chart entry flag
- stc ;exit to chart loop
- ret
-
- ;get box of route and save state of subchart stack
-
- get_route:
- push w sub_stack ;save stack pointer
- call get_route2 ;get box of route
- pull w sub_stack ;restore stack pointer
- cmp ax,first_box ;is route void?
- if b xor ax,ax ;indicate no route if it is
- ret ;exit
-
- ;get box of route in bx of box in ax
-
- get_route2:
- cmp bx,1 ;is there?
- ja get_route3 ;get next box of route if there is
- a1:
- xor ax,ax ;indicate no route
- ret ;exit
-
- ;check if route is subchart terminating route
-
- get_route3:
- cmp bx,first_box ;is route direct?
- jb >a2 ;get return box route if not
- mov ax,bx ;load box route
- ret ;exit
- a2:
- ; mov w levels,1 ;clear level count
- push bx,cx,dx,di,bp,es ;save registers
- mov dx,ax ;load current box
- mov cx,bx ;load route of box
- or bp,bp ;moving to route?
- jne >b3 ;leave parameters if not
- call get_box_par ;get box from current route
- mov bx,ax ;save it
-
- ;check if current box is at the end of a subchart
-
- b1:
- cmp ax,first_box ;is it?
- jae >b2 ;exit if not
- mov ax,dx ;load current box
- b3:
- ; inc w levels ;increment level count
- call get_box ;get current box pointer
-
- ;check if subchart is copied from elsewhere
-
- cmp w sub_stack,top_stack ;are there any subcharts on stack
- je >a1 ;load route from parent box if not
- call copy_substack ;copy stack data
- mov ax,w subchart_parent ;load parent of subchart on stack
- es cmp ax,w[di+parent] ;is subchart copied?
- jne >a1 ;load route from parent box if not
-
- ;copy box from parent of copied subchart
-
- mov ax,w subchart_box ;load step parent box
- mov dx,ax ;save it
- call get_box_par ;get route of current box of parent box
- add w sub_stack,4 ;clear copied subchart from stack
- jmp >a2 ;check parent route
-
- ;make box of parent of route of current box, current box
-
- a1:
- es mov ax,w[di+parent] ;load parent box of subchart
- mov dx,ax ;save it
- call get_box_par ;get its box
- mov bx,ax ;save offset to route
-
- ;check if there is a box from parent route
-
- a2:
- cmp ax,1 ;is there?
- ja b1 ;check if it isn't
- mov ax,dx ;load parent box of route
- ; jmp >b3 ;exit
-
- ;move to last level of new box
-
- b2:
- ; cmp w key_option,14*2 ;is user choosing a route for parent box
- ; je >b3 ;exit if yes
- ;a3:
- ; dec w levels ;is pointer at previous level?
- ; je >b3 ;exit if it is
- ; mov bx,child ;load child subchart element offset
- ; mov dx,ax ;save box
- ; call get_box_par ;is there a child subchart?
- ; or ax,ax
- ; je >a2 ;exit if not
- ; mov bp,dx ;load parent box
- ; call down2 ;move down a level
- ; mov ax,bp ;load child box
- ; jmp a3 ;decrement level count
- ;a2:
- ; mov ax,dx ;restore box
- b3:
- pull es,bp,di,dx,cx,bx ;restore registers
- ret ;exit
-
- ;copy subchart data from subchart stack
-
- copy_substack:
- push ax,si,es ;save box of subchart
- les si,w sub_stack ;load subchart stack pointer
- es lodsw ;load subchart box
- mov w subchart_box,ax ;save it
- es lodsw ;copy subchart parent (this may not be
- mov w subchart_parent,ax ;the same as subchart box if subchart is
- ;copied)
- pull es,si,ax ;restore box of subchart
- ret ;exit
-
- ;write box to screen
-
- write_box:
- call get_route ;get box of route along stem
- mov dx,ax
- mov b this_box,cl ;store box parameter
-
- ;copy box descripter string to buffer
-
- cmp cx,1 ;is box centre box?
- je >a1 ;clear other routes if it is
- mov es,ax,cs ;copy code segment
- mov di,o descripter_string ;load offset to descripter string buffer
- mov ax,dx ;load box number
- call get_box_descripter ;copy box descripter string to buffer
- push cx ;save string size
- rep
- movsb ;copy box descripter string
- mov ds,ax,cs ;restore data segment register
- pull w descripter_count ;store size of descripter
-
- ;copy box number to buffer
-
- mov di,o number_buffer ;load offset to buffer
- mov ax,': ' ;load trailing separator
- stosw ;store it at end/start of string
- mov ax,dx ;load box number
- sub ax,first_box-1
- call store_number2 ;write it to end of buffer
-
- ;clear other box routes
-
- a1:
- mov cx,2 ;load loop count
- xor si,si ;clear offset
- mov ax,si
- a1:
- mov w[si+other_box_routes],ax ;clear other routes
- mov w[si+other_boxes],ax ;clear other box routes for this box
- add si,2 ;increment offset
- loop a1 ;decrement loop count
-
- ;add any higher level subcharts to descripter string
-
- mov w box_route,bx ;save route
- mov ax,dx ;load box being written
- mov bx,parent ;load offset to box parent
- a1:
- call get_box_par ;get parent of it
- or ax,ax ;is there one?
- je >b1 ;copy path string to buffer if not
- mov dx,ax ;save parent box
-
- ;add parent box number to path string
-
- a2:
- mov al,':' ;load separator
- stosb ;write it to end of buffer
- mov ax,dx ;load parent box
- sub ax,first_box-1 ;calculate box number
- call store_number2 ;add it to end/start of path string
- jc >b1 ;copy path string if buffer full
- mov ax,dx ;load parent of box
- jmp a1 ;check if it has a parent
-
- ;copy path string to temporary buffer
-
- b1:
- mov si,di ;save offset to end of buffer
- dec si
- sub di,o number_buffer ;calculate size of string
- mov cx,di
- mov di,o s ;load offset to buffer
-
- ;copy string
-
- a1:
- std ;read backwards
- lodsb ;load character from path string
- cld ;write forwards
- stosb ;write character to buffer
- loop a1 ;decrement loop count
-
- ;copy descripter string to end of path string
-
- mov si,o descripter_string ;load offset to string
- mov cx,w descripter_count ;load length of it
- rep
- movsb ;copy descripter string to end of buffer
- sub di,o s ;calulate length of descripter string
- mov w descripter_count,di ;save it
-
- ;load following box for centre box
-
- cmp b this_box,1 ;is box centre box?
- jne >b1 ;check if it is leading box if not
- mov dx,w box ;load following box
- test b err,1 ;is there a following box?
- jne >a2 ;store it if there is
-
- ;get following box from centre box
-
- mov bx,w follow_route ;load following route
- mov ax,bx ;indicate no following box
- or bx,bx ;is there one?
- je >a1 ;clear follow box if not
- mov ax,dx ;load following box
- call get_box_par ;get box of route
- mov bx,ax
- mov ax,dx ;get following box
- call get_route
- a1:
- mov dx,ax ;load box
- a2:
- mov w follow_box,dx ;store following box
- jmp >b2 ;get other routes
-
- ;check if box being written is leading box
-
- b1:
- cmp b this_box,4 ;is box leading box?
- jne >b1 ;check if it is current box if not
- mov w follow_box,bp ;store current box as following box
- jmp >b2 ;get other routes
-
- ;get following box of following box
-
- b1:
- call get_follow_box ;get following box
- or ax,ax ;is there a box?
- if e mov ax,-2 ;indicate no following box
- mov w follow_box,ax ;save following box
-
- ;get any other routes from this box
-
- b2:
- mov w route_follow,0 ;indicate no following route
- mov si,yes ;load offset to box element
- xor di,di ;load offset to other routes store
- mov cx,2 ;load route/loop count
-
- ;get box of route of box
-
- b1:
- mov ax,w box_route ;load box of route
- mov dx,ax
- mov bx,si ;load box element
- call get_box_par ;get box of box route
- mov bx,ax
- mov ax,dx ;load route of box
- call get_route ;get box of route
- mov dx,ax
-
- ;check if route is not following box
-
- or dx,dx ;is there a box on this route?
- je >a1 ;decrement loop count if not
- cmp si,w main_route ;is route selected route?
- je >a3 ;check insert mode if it is
- cmp dx,w follow_box ;is route to following box?
- jne >a2 ;store other route if not
- cmp w insert_mode,2 ;is new box route being selected?
- jne >a4 ;save follow route if not
- cmp b this_box,1 ;is box centre box?
- jne >a4 ;save follow route if not
-
- ;copy box route data
-
- a2:
- mov w[di+other_boxes],dx ;store follow box
- mov w[di+other_box_routes],si ;store box route
- add di,2 ;move to next element
- jmp >a1 ;decrement loop count
-
- ;save following route
-
- a3:
- cmp b insert_mode,2 ;is route being selected for insert box?
- je >a4 ;store following route if it is
- cmp b this_box,1 ;is box centre box?
- je >a1 ;decrement loop count if it is
- a4:
- mov w route_follow,si ;store route element
- mov w follow_box,-2
- a1:
- add si,2 ;move to next route
- loop b1 ;decrement loop count
-
- ;store character for left route of stem
-
- mov bx,w other_box_routes ;load route offset
- add bx,10 ;load route
- mov bx,w[bx+options_table] ;load offset to option string
- mov al,b[bx] ;load route option character
- cmp di,2 ;is there one route?
- jne >a1 ;store route indicator if not
- cmp w route_follow,0 ;is there a decision route
- if e mov al,'F' ;load forward indicator if not
- a1:
- mov b left_route_indicator,al ;save it
-
- ;split descripter string if it is longer than 3/4rs of screen width
-
- mov w stem_start,1 ;assume descripter string is one row
- mov b split_line,0 ;indicate line not split
- cmp w descripter_count,60 ;is descripter string bigger than 3/4rs
- jbe >c1 ;check if there is another route if not
- mov si,w descripter_count ;calculate offset to half of string
- shr si,1
- mov cx,si
- add si,o s
- mov b hyphen,0 ;indicate end of line not hyphenated
- mov b split_line,0ffh ;indicate line split
-
- ;calculate quarter of length of half of string
-
- shr cx,1 ;divide half by four
- mov ax,cx ;save offset incase line can't be split
- shr ax,1
- mov di,si ;save offset to descripter
- add si,ax
- a1:
- dec si ;decrement offset
- cmp b[si],' ' ;can line be split without hyphenating?
- loopne a1 ;decrement loop count
-
- ;restore offset to line half if can't be hyphenated
-
- je >b1 ;save offset if it can
- mov si,di ;restore offset to line half
- inc si ;move to last character
- cmp b[si],' ' ;will hypenation look odd?
- je >b1 ;leave offset if it will
- dec si ;restore offset
- mov b hyphen,'-' ;indicate line to be hyphenated
- b1:
- mov w split_line+1,si ;save offset to end of first half
-
- ;create string for left other route (if there is one)
-
- c1:
- mov b left_route,0 ;indicate no left route stem
- mov si,o other_boxes ;load second route flag
- cmp w[si],0 ;is there another route?
- je >c1 ;check if this box is centre box if not
- mov bx,w[si+obro] ;load route element
- mov di,o akey_jump+2 ;load offset to left key address
- call write_akey_address ;write jmp address for left arrow key
- call get_hor_stem ;get second route stem
- mov di,o left_route ;load offset to buffer
- je >b1 ;write graphics if outstanding route
-
- ;copy path/descripter to left route store
-
- mov si,bx ;load source offset
- mov cx,dx ;load count
- dec cx ;adjust it
- rep
- movsb ;copy path/descripter
- lodsb ;load last character
-
- ;store graphic characters
-
- b1:
- stosb ;store first/last character from path
- mov ax,'═╞' ;load left end stem and horz stem chrs
- stosw ;store it at end of string
- mov al,b left_route_indicator ;load left route indicator
- stosb ;store it in string
- mov ax,'╣═' ;load middle left stem characters
- stosw ;store them at end of string
- mov w left_route_end,di ;save offset to end of string
-
- ;check if there is a third route
-
- mov si,o other_boxes+2 ;load other route
- cmp w[si],0 ;is there a third route?
- je >c1 ;set attribute if not
-
- ;copy path/descripter to left route store
-
- dec di ;move offset over centre graphic
- mov ax,'═╬' ;load horizontal double bar graphic
- stosw ;store graphics to string
- mov si,w[si+obro] ;load route element
- shr si,1
- mov al,b[si+keys+5] ;load route indicator
- mov ah,'═' ;load graphic
- stosw ;write it with route character to buffer
- mov al,'╡' ;load graphic character
- stosb ;write it to end of string
- mov al,'?' ;load outstanding route character
- stosb ;write it to end of horizontal stem
-
- ;set attribute for descripter string
-
- c1:
- mov b attribute,novid ;store normal video attribute
- cmp b this_box,1 ;is box centre box?
- if e mov b attribute,revid ;store reverse video attribute
-
- ;check if descripter string is hyphenated
-
- mov si,o s ;load offset to string
- cmp b split_line,0 ;is line split?
- je >b1 ;write descripter string if not
- inc w stem_start ;add it to stem length
- mov cx,w split_line+1 ;load offset to end of second half
- sub cx,si ;calculate length of first half
- sub w descripter_count,cx ;calculate length of second half
-
- ;position cursor for string and write descripter string to screen
-
- mov dl,80 ;load max screen width
- sub dl,cl ;subtract length of string
- shr dl,1 ;half it
- mov dh,b cursor_pos+1 ;load cursor row
- inc b cursor_pos+1 ;increment it
- call cursor ;position cursor
- a1:
- lodsb ;load character from string
- call write_chr ;write it to screen
- loop a1 ;decrement loop count
-
- ;write hyphen character if line is hyphenated
-
- mov al,b hyphen ;load hyphen flag
- or al,al ;is it?
- je >a1 ;increment offset to second half if not
- call write_chr ;write hyphen character to screen
- dec si ;adjust offset to descripter string
- inc w descripter_count ;adjust count
- a1:
- inc si ;move offset past space
- dec w descripter_count
-
- ;position cursor for string and write descripter string to screen
-
- b1:
- mov cx,w descripter_count ;load length of string
- mov dl,80 ;load max screen width
- sub dl,cl ;subtract length of string
- shr dl,1 ;half it
- mov dh,b cursor_pos+1 ;load cursor row
- inc b cursor_pos+1 ;increment it
- call cursor ;position cursor
- a1:
- lodsb ;load character from string
- call write_chr ;write it to screen
- loop a1 ;decrement loop count
-
- ;store normal video attribute
-
- mov b attribute,novid ;store normal video attribute
- mov w indicator,' ' ;indicate no leading stem
- mov si,o left_route ;load offset to stem string
- cmp b[si],0 ;are there any other routes?
- jne >a1 ;calculate column if there are
- mov al,b this_box ;load box being written to screen
- and al,b err ;is there a following box?
- mov al,' ' ;load space
- je >c1 ;check for subchart if not
- mov di,si ;load offset to start of string
- mov al,'╥' ;load top stem character
- stosb ;write it to string
- mov dx,w cursor_pos ;load cursor coordinates
- jmp >a2 ;increment row marker
-
- ;write jump address for arrow key
-
- write_akey_address:
- cmp b this_box,1 ;is box centre box?
- jne ret ;exit if not
- mov ax,w[bx+akey_addresses] ;load jump address
- stosw ;write it to key jump address
- ret ;exit
-
- ;calculate column for horizontal stem
-
- a1:
- mov cx,w left_route_end ;load offset to end of left route
- sub cx,si ;calculate length of left route string
- mov dl,40 ;load column of centre of screen
- sub dl,cl ;calculate length of left route stem
- mov dh,b cursor_pos+1 ;load row
- a2:
- mov b indicator,'║' ;indicate leading stem
- inc b cursor_pos+1 ;increment row
- call cursor ;position cursor
-
- ;write horizontal stem to screen
-
- mov cx,di ;load offset to end of string
- sub cx,si ;calculate length of string
- a1:
- lodsb ;load character from stem string
- call write_chr ;write it to screen
- loop a1 ;decrement loop count
- inc b stem_start ;decrement leading stem size
-
- ;create route indicator string for trailing stem
-
- b1:
- mov di,o akey_jump ;load offset to arrow key jump address
- mov dl,'F' ;load forward route indicator
- mov si,w route_follow ;load following route for stem
- or si,si ;is box decision box?
- mov bx,si ;load offset to forward move address
- je >a1 ;store indicator if not
- mov ax,w box_route ;load box being written
- mov bx,no ;load element of box
- call get_box_par ;get decision box flag
- or ax,ax ;is box decision box?
- mov bx,ax ;load offset to forward move address
- je >a1 ;store indicator if not
- mov bx,si ;load sub offset to jump address
- shr si,1 ;load route indicator
- mov dl,b[si+keys+5]
-
- ;store following box route indicator
-
- a1:
- call write_akey_address ;write arrow key address to table
- mov al,dl ;load route indicator
- c1:
- mov di,o indicator+2 ;load offset to indicator string
- stosb ;store indicator character
-
- ;check if there is a child subchart from box
-
- mov dx,'][' ;assume subchart is not copied
- mov ax,w box_route ;load box being written to screen
- mov bx,child ;load offset to element
- call get_box_par ;get box child subchart status
- cmp ax,first_box ;is there a subchart?
- jb >b1 ;terminate indicator string if not
- mov bx,parent ;load element offset
- call get_box_par ;get subcharts parent box
- cmp ax,w box_route ;is subchart copied?
- if ne mov dx,')(' ;load copied subchart brackets if it is
-
- ;write subchart indicator to end of indicator string
-
- mov al,' ' ;load space
- mov ah,dl ;load open bracket character
- stosw ;write it to indicator string
- mov al,'D' ;load option character
- mov ah,dh ;load close bracket indicator
- stosw ;write it to end of indicator string
-
- ;terminate indicator string and exit
-
- b1:
- xor al,al ;clear register
- stosb ;terminate indicator string
- ret ;exit
-
- ;write message to message buffer
-
- write_message:
- xor cx,cx ;clear count
- mov di,o message ;load offset to buffer
- mov es,ax,cs ;copy code segment
- pull si ;load offset to message string
- a1:
- lodsb ;read character from message string
- or al,al ;last character?
- je >a2 ;store message length if it is
- inc cx ;increment message length
- stosb ;write it to buffer
- jmp a1 ;read next character
- a2:
- mov w message_length,cx ;store message length
- jmp si ;exit
-
- ;write number in ax:dx to number buffer
-
- store_number:
- mov di,o number_buffer ;load address of buffer for characters
-
- ;divide number by 10
-
- store_number2:
- push bx,dx ;save registers
- xor dx,dx ;clear register
- jmp >a1 ;convert number to string
- store_number3:
- push bx,dx ;save registers
- a1:
- mov si,di ;save offset to buffer
-
- ;divide number by 10
-
- a3:
- mov w temp3,0 ;initialise remainder
- mov cx,32 ;load iteration count
- a1:
- shl ax,1 ;shift low accumulator left one bit
- rcl dx,1 ;shift high accumulator left with carry
- rcl w temp3,1 ;shift third word ieft
- cmp w temp3,10 ;will 10 go into third word?
- jb >a2 ;decrement loop count if not
- sub w temp3,10 ;subtract 10 from accumulator high
- add ax,1 ;increment accumulator
- adc dx,0
- a2:
- loop a1 ;decrement loop count
-
- ;store digit in buffer
-
- mov bl,b temp3 ;load remainder
- add bl,48 ;asciiize the remainder
- mov [di],bl ;store it in number character buffer
- inc di ;increment pointer
- or ax,dx ;any more digits?
- jne a3 ;fetch next digit if another digit
-
- ;exit with offset to start of string in si and length in cx
-
- a1:
- mov cx,di ;load offset to end of string
- sub cx,si ;calculate length of string
- mov bx,di ;calculate size of string in buffer
- sub bx,o number_buffer
- jc >a1 ;exit if string is not path string
- cmp bx,20 ;is there enough room for string?
- jbe >a1 ;carry on if there is
- sub di,cx ;restore offset to end of string
- mov b[di],27 ;store marker
- pull dx,bx ;restore registers
- stc ;indicate error
- ret ;exit
-
- ;exit indicating number string copied
-
- a1:
- mov si,di ;load offset to string
- dec si
- pull dx,bx ;restore registers
- clc ;indicate ok
- ret ;exit
-
- ;end